// import EventEmitter from 'wolfy87-eventemitter';

class MockImage {
    source = '';

    // ee = new EventEmitter();

    // constructor() {
    //     this.ee.defineEvents(['load', 'error']);
    // }

    set src(value) {
        this.source = value;
        if (value.indexOf('weipaitang') > -1) {
            if (this.onload) {
                this.onload();
            }
            // console.log(value);
            // this.ee.emitEvent('load');
        }

        if (this.onerror) {
            this.onerror();
        }
        // this.ee.emitEvent('error');
    }

    // addEventListener(event, callback) {
    //     this.ee.addListener(event, callback);
    // }

    get src() {
        return this.source;
    }
}

global.Image = MockImage;
